package com.briup.jz.web.controller;


import com.briup.jz.bean.OrderLine;
import com.briup.jz.bean.extend.OrderLineExtend;
import com.briup.jz.service.IOrderLineService;
import com.briup.jz.utils.Message;
import com.briup.jz.utils.MessageUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/OrderLine")
@Api(description="订单项管理接口")
public class OrderLineController {

    @Autowired
    private IOrderLineService iOrderLineService;
    @PostMapping("saveorudate")
    @ApiOperation("保存定单项")
    public Message saveorudate(OrderLine orderLine){
        iOrderLineService.saveOrUpdate(orderLine);
        return MessageUtil.success("操作成功");
    }

    @GetMapping("query")
    @ApiOperation("查询订单项")
    public  Message query(Long id,Long proid,Long orderid){
        List<OrderLineExtend> orderLines = iOrderLineService.queryWithPro(id);
        return  MessageUtil.success(orderLines);
    }
    @GetMapping("delete")
    @ApiOperation("删除定单项")
    public Message delete(Long id){
        iOrderLineService.deleteById(id);
        return MessageUtil.success("操作成功");
    }
}
